POV-Ray : Newsgroups : povray.general : Random-Placement of Objects : Re: Random-Placement of Objects Server Time
2 Aug 2024 02:26:25 EDT (-0400)
  Re: Random-Placement of Objects  
From: Tim Nikias
Date: 9 Feb 2005 10:41:10
Message: <420a2f16@news.povray.org>
First, initialize a random stream like this:

#declare Random_Value=seed(12345);

Then, whenever you need a random number between 0 and 1, use
rand(Random_Value).

Multiplying that with values and clipping it with either floor() or ceil()
should get you integers. For example, for a random number between 10 and 20,
do this:
#declare Random_Number = floor(10+10*rand(Random_Value));

Consult the documentation about rand() and seed() for more insight. This
post should only get you started. :-)

Regards,
Tim

-- 
"Tim Nikias v2.0"
Homepage: <http://www.nolights.de>


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.